package lib.self.ex.decor;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import lib.self.R;
import lib.self.ex.ParamsEx;

/**
 * description: 加载时的View
 * author: Steven Xiao
 * date: 2017/5/2
 */
public class LoadingView extends RelativeLayout {
    private View mLoadingView;

    public LoadingView(Context context) {
        super(context);
        init();
    }

    public LoadingView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public LoadingView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {
        if (ParamsEx.getLoadingViewId() != 0) {
            mLoadingView = inflate(getContext(), ParamsEx.getLoadingViewId(), null);
        } else {
            mLoadingView = inflate(getContext(), R.layout.view_loading_default, null);
        }
        addView(mLoadingView, LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    }
}
